package com.base.controller.pms;

import com.base.api.pms.PmsSqlQueryService;
import com.base.vo.pms.PmsSqlQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "/pms", produces = "application/json;charset=UTF-8")
public class PmsSqlQueryController {
    @Autowired
    private PmsSqlQueryService pmsSqlQueryService;

    @PostMapping("/GetSqlQuery")
    public String GetSqlQuery(@RequestBody Map<String,Object> params) {
        return pmsSqlQueryService.getSqlQueryByKeywords(params);
    }

    @PostMapping("/saveSqlQuery")
    public String saveSqlQuery(@RequestBody PmsSqlQuery pmsSqlQuery) {
        return pmsSqlQueryService.saveSqlQuery(pmsSqlQuery);
    }

    @PostMapping("/query")
    public String query(@RequestBody Map<String,Object> params) {
        return pmsSqlQueryService.Query(params);
    }

    @PostMapping("/GetSqlQueryByCode")
    public String GetSqlQueryByCode(@RequestBody Map<String,Object> params) {
        return pmsSqlQueryService.getSqlQueryByCode(params);
    }
}
